<template>
  <div class="job-responsibility-container">
    <!-- 代办领导 -->
    <div class="leader-info-container">
      <h3 class="title">带班领导</h3>

      <!-- item -->
      <div class="leader-item flex align-center justify-space-between" v-for="leader in data.leader">
        <div class="leader-person-info">
          <span class="leader-icon">
            <img class="block" src="~assets/images/leader-icon.png" alt="">
          </span>
          <span class="leader-name">{{ leader.name }}</span>
        </div>
        <div class="leader-position-info">
          <span class="leader-position-department position-item">{{ leader.department }}</span>
          <span class="leader-position-name position-item">{{ leader.position }}</span>
        </div>
      </div>
    </div>

    <!-- 现场管理 -->
    <div class="live-place-container">
      <h3 class="title">现场管理</h3>

      <div class="tr-item live-header">
        <div class="col-3">岗位角色</div>
        <div class="col-3">总人数</div>
        <div class="col-3">考勤打卡</div>
      </div>
      <div class="tr-item" v-for="p in data.live">
        <div class="col-3">{{ p.player }}</div>
        <div class="col-3">{{ p.allCount }}人</div>
        <div class="col-3">{{ p.attendance }}人</div>
      </div>
    </div>

    <!-- 安质管理 -->
    <div class="safe-quality-container">
      <h3 class="title">安质管理</h3>

      <div class="tr-item" :class="{'live-header': index === 0}" v-for="(m, index) in data.management">
        <div class="col-3">{{ m.type }}</div>
        <div class="col-3">{{ m.count }}</div>
        <div class="col-3"></div>
      </div>
    </div>
  </div>
</template>

<script>
  // TODO-构造数据结构
  export default {
    props: {
      data: {
        type: Object,
        default: () => {},
      }
    },
  }
</script>

<style lang="scss" scoped>
  .job-responsibility-container {
    height: calc(100% - 36px);
    padding: 0 6px;
    color: #fff;
    font-size: 6px;
    overflow: auto;

    .title {
      line-height: 20px;
      font-size: 7px;
    }

    /** 带班领导item start **/
    .leader-item {
      height: 27px;
      background-image: url("~assets/images/leader-bg.png");
      background-size: 100% 100%;
      margin-bottom: 4px;

      &:last-child {
        margin-bottom: 0px;
      }

      .leader-icon {
        display: inline-block;
        margin: 0px 4px 0 6px;
        width: 6px;
        height: 6px;
        vertical-align:  -1px;
      }

      .leader-position-info {
        margin-right: 7px;

        .position-item {
          display: inline-block;
          width: 70px;
          height: 14px;
          line-height: 14px;
          text-align: center;
          background: rgba(0,106,255,0.18);
        }

        .leader-position-department {
          color: #00FFD4;
        }

        .leader-position-name {
          margin-left: 7px;
          color: #FFF363;
        }
      }
    }
    /** 带班领导item end **/

    /** table tr item start **/
    .tr-item {
      line-height: 15px;
      font-size: 6px;
      background: rgb(3, 35, 80);
      opacity: 0.7;
      margin-bottom: 1px;

      .col-3 {
        display: inline-block;
        width: 33.3%;
        text-align: center;
      }

      &.live-header {
        position: relative;
        opacity: .9;
        margin-bottom: 0;

        &:after {
          position: absolute;
          content: '';
          height: 1px;
          left: 0;
          right: 0;
          bottom: -1px;
          background-size: 100% 100%;
          background-image: url("~assets/images/live-header-bg.png");
        }
      }
    }
    /** table tr item end **/
  }
</style>
